package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.entity.enums.eChatContentType;
import com.yanqu.road.entity.enums.eMessageType;
import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.pb.worldmessage.WorldMessageProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.WorldMessageMgr;
import com.yanqu.road.server.pb.WorldMessagePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Author wpj
 * @Date 2020/10/17
 */
@Cmd(code = GameProtocol.S_HUA_SHI_GANG_NOTIFY_SYSTEM_MSG, desc = "花石纲系统通知")
public class HuaShiGangNotifySystemMsgFromCrossCmd extends AbstractCommand {

    int activityId;
    String content;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.HuaShiGangSystemNotify msg = HuaShiGangProto.HuaShiGangSystemNotify.parseFrom(packet.getBytes());
        activityId = msg.getActivityId();
        content = msg.getContent();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        WorldMessageProto.WorldMessageTempMsg.Builder msg = WorldMessagePb.parseWorldMessageTempMsg(player.getUserInfo(), eMessageType.HuaShiGangSystemMsg.getValue(), eChatContentType.Common.getContentType(), content, System.currentTimeMillis(), activityId, null);
        WorldMessageMgr.sendCrossActivityChat(msg);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
